package com.leyu.mall.admin.cms.service.impl;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.leyu.mall.admin.cms.dao.CmsContentMapper;
import com.leyu.mall.admin.cms.domain.CmsContent;
import com.leyu.mall.admin.cms.service.ICmsContentService;
import com.leyu.mall.common.facade.ICmsContentFacade;

@Service
@Transactional(rollbackFor=Exception.class)
public class CmsContentServiceImpl implements ICmsContentService,ICmsContentFacade{
	
	@Resource(name="cmsContentMapper")
	private CmsContentMapper cmsContentMapper;
	

	public CmsContent find(Long entity_id)  throws Exception{
		return cmsContentMapper.getCmsContentById(entity_id);
	}

	public void save(CmsContent entity) throws Exception{
		if(entity.getContentID()== null){
			cmsContentMapper.addCmsContent(entity);
			
		}
		else{
		
			cmsContentMapper.updateCmsContent(entity);
		}
 
	}
	public void delete(Long  id)throws Exception{
		cmsContentMapper.deleteCmsContent(id);
	}
	public List<CmsContent> getcmsContentList()throws Exception{
		 
 
		return cmsContentMapper.getAllCmsContent();
		
	}
	
	/**
	 * 查询广告列表
	 */
	public List<CmsContent> getDisplayADList()throws Exception{	 
		return cmsContentMapper.getDisplayADList();
		
	}
	
	
}